// add-openid-server.js

var AddOpenIDServer = {};

AddOpenIDServer.load = function() {
    document.getElementById("openid-server-textbox").focus();
};

AddOpenIDServer.unload = function() {
    // do nothing
};

AddOpenIDServer.cancel = function() {
    window.close();
};

AddOpenIDServer.save = function() {
    var messages = document.getElementById("message-bundle");
    try {
        var server = document.getElementById("openid-server-textbox").value;

        if (server == "") {
            alert(messages.getString("blankidserver"));
        } else {
            document.getElementById("ok-button").disabled = true;
            AppalachianDB.addServer(window.arguments[0].openid, server);
            window.close();
        }
    } catch (e) {
        alert(messages.getString("failure") + " " + e);
    }
};
